﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace CaramelEngine.Dice
{
    /// <summary>
    /// Base implementation of Dice. It has sides and it can be rolled.
    /// </summary>
    public class Dice : IDice
    {
        private readonly int _diceSides;
        internal static readonly Random Rand = new Random();

        /// <summary>
        /// The number of sides the dice has.
        /// </summary>
        public int DiceSides { get { return _diceSides; } }

        /// <summary>
        /// Creates a dice object of desired side type.
        /// </summary>
        /// <param name="diceSides">Number of sides on the dice. (4, 6, 8, 10, etc.)</param>
        public Dice(int diceSides = 6)
        {
            _diceSides = diceSides;
        }

        /// <summary>
        /// Returns a value between one and the highest side.
        /// </summary>
        /// <returns>Integer of the rolled side.</returns>
        public virtual int Roll()
        {
            return Rand.Next(1, _diceSides);
        }
    }
}
